#ifndef CRAZYCOLOREDSQUARE_H
#define CRAZYCOLOREDSQUARE_H

/*!
 * \file      crazycoloredsquare.h
 * \brief     Square painted with brownian color.
 * \author    Duriez Franck
 * \author    Carton Paul-Henri
 * \version   0.1
 */

#include <SFML/Graphics.hpp>
#include "square.h"

/*!
 * \class CrazyColoredSquare
 * \brief Square painted with brownian Color.
 *
 * This is an example of Square implementation.
 */
class CrazyColoredSquare : public Square /*{{{*/
{
/*{{{*/
public:
	/*!
	 * \brief Constructor.
	 * \param displayWidget : where display the square
	 * \param dt            : pointer to the infinitesimal part of time
	 */
	CrazyColoredSquare(QSFMLWidget* displayWidget, float* dt);

	/*!
	 * \brief Constructor.
	 * \param displayWidget : where display the square
	 * \param dt            : pointer to the infinitesimal part of time
	 * \param color         : color of the square
	 */
	CrazyColoredSquare(QSFMLWidget *displayWidget, float *dt, sf::Color color);

	/*!
	 * \brief Constructor.
	 */
	~CrazyColoredSquare();

private:
	/*
	 * \brief This function change a colorComponant of the Square Color.
	 * \param colorComponant : reference to a colorComponant
	 */
	void moveColorComponant(int& colorComponant);
	/*
	 * \brief This function change the Color of the Square.
	 */
	void moveColor();
/*}}}*/

	/************
	 * DRAWABLE *
	 ************/
/*{{{*/
public:
	virtual void draw() const;
	virtual void update();

	// absolute setters
	virtual void setCenter(Vector2f center);
	virtual void setPosition(Vector2f position);
	virtual void setRotation(float angle);

	// relative setters
	virtual void moveCenter(Vector2f dcenter);
	virtual void move(Vector2f dposition);
	virtual void rotate(float dangle);

	// getters
	virtual Vector2f getCenter() const;
	virtual Vector2f getPosition() const;
	virtual float getRotation() const;

	// description
	virtual std::string toString() const;
/*}}}*/

	/***********
	 * ACTIONS *
	 ***********/
/*{{{*/
private:
	void destroyStartingProcess();
	void destroyProcess();
	void destroyStoppingProcess();
/*}}}*/

	/**************
	 * ATTRIBUTES *
	 **************/
/*{{{*/
	int m_R;                             ///< Red componant of the color
	int m_G;                             ///< Green componant of the color
	int m_B;                             ///< Blue componant of the color
	int m_A;                             ///< Transparency componant of the color
	sf::Shape m_shape;                   ///< Polygon used to draw a colored square
	float m_time_elapsed_on_destruction; ///< destruction timer
/*}}}*/
}; /*}}}*/

#endif // CRAZYCOLOREDSQUARE_H
